package com.turnengine.client.global.game.command;

import com.javabi.command.IExecutableCommand;
import com.javabi.command.IExecutableCommandResponse;
import com.javabi.command.serializer.AbstractCommandDataSerializer;
import com.javabi.common.io.data.IDataReader;
import com.javabi.common.io.data.IDataWriter;
import com.turnengine.client.global.game.bean.GameVersionSerializer;
import com.turnengine.client.global.game.bean.IGameVersion;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * The Get Game Versions Data Serializer.
 */
public class GetGameVersionsDataSerializer extends AbstractCommandDataSerializer<List<IGameVersion>> implements IGetGameVersionsDataSerializer {

	/**
	 * Creates a new Get Game Versions Data Serializer.
	 */
	public GetGameVersionsDataSerializer() {
		super(GetGameVersions.COMMAND_ID);
	}

	@Override
	public List<IGameVersion> readReturnValue(IDataReader reader) throws IOException {
		List<IGameVersion> value = reader.readObjectCollection(new ArrayList<IGameVersion>(), true, false, new GameVersionSerializer());
		return value;
	}

	@Override
	public void writeReturnValue(IDataWriter writer, List<IGameVersion> value) throws IOException {
		writer.writeObjectCollection(value, true, false, new GameVersionSerializer());
	}

	@Override
	public IExecutableCommand<List<IGameVersion>> readRequest(IDataReader reader) throws IOException {

		// Read fields

		// Create object
		GetGameVersions object = new GetGameVersions();
		return object;
	}

	@Override
	public void writeRequest(IDataWriter writer, IExecutableCommand<List<IGameVersion>> argument) throws IOException {
		GetGameVersions object = (GetGameVersions) argument;

		// Get fields

		// Write fields
	}

	@Override
	public IExecutableCommandResponse<List<IGameVersion>> newResponse() {
		return new GetGameVersionsResponse();
	}
}
